import { Injectable } from '@nestjs/common';

import { PrismaService } from 'src/prisma/prisma.service';

@Injectable()
export class ChangeUserAvatarService {
  constructor(private prisma: PrismaService) {}
  async create(req: any, file: any) {
    const user = await this.prisma.user.findFirst({
      where: {
        id: req.user.id,
      },
    });
    user.avatar = file.path;
    return {
      avatar: user.avatar,
      message: '修改头像成功',
    };
  }
}
